<?php

namespace UFSW\TorneoBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class TorneoType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('nombre')
            ->add('descripcion', 'textarea', array(
            		'label' => 'descripcion',
            		'required'	=> false,
            		))
            ->add('ciudad')
            ->add('fechaInicio','date', array(
            		'label' => 'inicio'))
            ->add('fechaFin','date', array(
            		'label' => 'fin'))
            ->add('tipo', 'choice',array(
            	'label' => 'tipo.torneo',
            	'choices' => array(
            			'01' => 'HAT',
            			'02' => 'por.equipos'
            			),
            	'required' => true,))
            ;
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'UFSW\DataBaseBundle\Entity\Torneo'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'ufsw_torneo';
    }
}
